﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForm1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static Dictionary<string, string> user = new Dictionary<string, string>(); 

        //登录
        private void button1_Click(object sender, EventArgs e)
        {
            var uid = txtUid.Text;

            var pwd = txtPwd.Text;

            var sql = string.Format("select * from Users where Username='{0}'and Password='{1}'",uid,pwd);

            var data = DBHelper.GetDataTable(sql);

            if (data.Rows.Count==1)
            {
                MainForm mainForm = new MainForm();

                MessageBox.Show("登录成功","提示");

                mainForm.Show();

                this.Hide();

            }
            else
            {
                MessageBox.Show("登录失败","提示");
            }

        }


        //注册
        private void button3_Click(object sender, EventArgs e)
        {
            RegisterForm registerForm = new RegisterForm();

            registerForm.Show();
        }
    }
}
